"""
auth : ginger
读取配置文件数据
"""

from configparser import ConfigParser
from common.do_file_path import CONFIGURATION_PATH


def get_conf_data(section, option):
    conf = ConfigParser()
    conf.read(CONFIGURATION_PATH, encoding='utf8')
    return conf.get(section, option)


def get_conf_data_bool(section, option):
    conf = ConfigParser()
    conf.read(CONFIGURATION_PATH, encoding='utf8')
    return conf.getboolean(section, option)


def get_conf_data_int(section, option):
    conf = ConfigParser()
    conf.read(CONFIGURATION_PATH, encoding='utf8')
    return conf.getint(section, option)


log_level = get_conf_data('log_level', 'logger').upper()
console_level = get_conf_data('log_level', 'console').upper()
file_level = get_conf_data('log_level', 'file').upper()

username = get_conf_data('user', 'username')
password = get_conf_data('user', 'password')

ignore_project_s = eval(get_conf_data('ignore', 'ignore_name_s'))

if __name__ == '__main__':
    print(log_level)
    print(console_level)
    print(file_level)

    print(username)
    print(password)

    print(ignore_project_s)
    print(type(ignore_project_s))
